package entity

import "gorm.io/datatypes"

type News struct {
	ID          int            `gorm:"column:id;primaryKey"`
	Title       string         `gorm:"column:title"`
	Type        int            `gorm:"column:type"`
	Media       datatypes.JSON `gorm:"column:media"`
	Content     string         `gorm:"column:content"`
	Channel     string         `gorm:"column:channel"`
	PublishTime string         `gorm:"column:publish_time"`
}

func (News) TableName() string {
	return "news"
}

type Favorites struct {
	UserId int `gorm:"column:user_id"`
	NewsId int `gorm:"column:news_id"`
}

func (Favorites) TableName() string {
	return "favourites"
}

type NewsLikes struct {
	NewsId   int   `gorm:"column:news_id"`
	UserId   int   `gorm:"column:user_id"`
	LikeTime int64 `gorm:"column:like_time"`
}

func (NewsLikes) TableName() string {
	return "news_likes"
}
